
using System;
using System.Net.NetworkInformation;

class NetworkInterfaceHelper
{

  public NetworkInterface FindInterfaceByType(NetworkInterfaceType type)
  {
    foreach ( NetworkInterface adapter in mInterfaces )
    {
      if ( adapter.NetworkInterfaceType == type )
        return adapter;
    }
    return null;
  }

  static void WriteInterfaceInformation(NetworkInterface adapter)
  {
    Console.WriteLine(adapter.Description);
    Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length, '='));
    Console.WriteLine("  State ................................... : {0}", adapter.OperationalStatus);
    Console.WriteLine("  Interface type .......................... : {0}", adapter.NetworkInterfaceType);
    Console.WriteLine("  Physical Address ........................ : {0}", adapter.GetPhysicalAddress());
    Console.WriteLine("  Is receive only.......................... : {0}", adapter.IsReceiveOnly);
    Console.WriteLine("  Multicast................................ : {0}", adapter.SupportsMulticast);
    Console.WriteLine();
  }

  NetworkInterface [] mInterfaces = NetworkInterface.GetAllNetworkInterfaces();

}
